import pandas as pd

def convert_ssq_excel_to_csv(excel_file_path, sheet_name, output_csv_path):
    """
    将双色球的Excel文件转换为特定格式的CSV文件
    :param excel_file_path: Excel文件路径
    :param sheet_name: 需要转换的Sheet名称
    :param output_csv_path: 输出的CSV文件路径
    """
    df = pd.read_excel(excel_file_path, sheet_name=sheet_name)
    
    # 假设双色球数据在指定列，需要提取和格式化
    df = df[['开奖日期', '红球1', '红球2', '红球3', '红球4', '红球5', '红球6', '蓝球']]
    df.columns = ['date', 'red1', 'red2', 'red3', 'red4', 'red5', 'red6', 'blue']
    
    df.to_csv(output_csv_path, index=False)
    print(f"双色球数据已转换为CSV格式，保存到 {output_csv_path}")

if __name__ == "__main__":
    excel_file_path = "data/raw/ssq/lottery_data.xlsx"
    sheet_name = "Sheet1"
    output_csv_path = "data/raw/ssq/lottery_data.csv"
    
    convert_ssq_excel_to_csv(excel_file_path, sheet_name, output_csv_path)